Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(open): set wait: false to run server.close successfully #2001

Merged
merged 4 commits into from
Jun 10, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jun 8, 2019

fixes: #1990

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

yes

Motivation / Use-Case

see #1990

commit: sindresorhus/open@da2d663#diff-168726dbe96b3ce427e7fedce31bb0bcR23

Our open(opn)'s version is old, and wait seems to be true by default in this version.

Breaking Changes

no

Additional Info

@hiroppy hiroppy force-pushed the feature/fix-open branch from 36bd9b8 to bf696bd Compare June 8, 2019 13:16
alexander-akait
alexander-akait previously approved these changes Jun 8, 2019
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

@codecov
Copy link

codecov bot commented Jun 9, 2019

Codecov Report

Merging #2001 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2001   +/-   ##
=======================================
  Coverage   92.77%   92.77%           
=======================================
  Files          29       29           
  Lines        1149     1149           
  Branches      327      327           
=======================================
  Hits         1066     1066           
  Misses         79       79           
  Partials        4        4
Impacted Files Coverage Δ
lib/utils/runOpen.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90d4a7c...eb3fce5. Read the comment docs.

@hiroppy
Copy link
Member Author

hiroppy commented Jun 9, 2019

@evilebottnawi I added one commit(fdc6d31). PTAL

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need modify object, it is really bad practice

openOptions = { app: options.open };
Object.assign(openOptions, {
app: options.open,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let openOptions = { wait: false };
// ...
if (typeof options.open === 'string') {
  openOptions = Object.assign({} openOptions, { app: options.open });
}

No need modify openOptions variable, it is very bad practice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openOptions = Object.assign({} openOptions, { app: options.open }); equals Object.assign(openOptions, { app: options.open }).

I don't think this is a very bad practice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it is not good, we modify original object and it is bad practice because you can forget about this in future and it is lead to some problems when you refactor code.

When you pass options to third party package(s) better always cloning object. Other package can modify object too so it can lead to very strange errors and situations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you pass options to third party package(s) better always cloning object. Other package can modify object too so it can lead to very strange errors and situations.

If you say, we should not assign to the same variable.

I don't have any strong opinions, so I'll change.

@hiroppy hiroppy force-pushed the feature/fix-open branch from a64edce to abeaa9c Compare June 10, 2019 12:24
@hiroppy
Copy link
Member Author

hiroppy commented Jun 10, 2019

@evilebottnawi PTAL

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

server.close no longer works as of 3.4.0
2 participants